package com.qianfeng.excel.pojo;

//
//                            _ooOoo_  
//                           o8888888o  
//                           88" . "88  
//                           (| -_- |)  
//                            O\ = /O  
//                        ____/`---'\____  
//                      .   ' \\| |// `.  
//                       / \\||| : |||// \  
//                     / _||||| -:- |||||- \  
//                       | | \\\ - /// | |  
//                     | \_| ''\---/'' | |  
//                      \ .-\__ `-` ___/-. /  
//                   ___`. .' /--.--\ `. . __  
//                ."" '< `.___\_<|>_/___.' >'"".  
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |  
//                 \ \ `-. \_ __\ /__ _/ .-` / /  
//         ======`-.____`-.___\_____/___.-`____.-'======  
//                            `=---='  
//  
//         .............................................  
//                  佛祖镇楼                  BUG辟易  
//          佛曰:  
//                  写字楼里写字间，写字间里程序员；  
//                  程序人员写程序，又拿程序换酒钱。  
//                  酒醒只在网上坐，酒醉还来网下眠；  
//                  酒醉酒醒日复日，网上网下年复年。  
//                  但愿老死电脑间，不愿鞠躬老板前；  
//                  奔驰宝马贵者趣，公交自行程序员。  
//                  别人笑我忒疯癫，我笑自己命太贱；  
//  


/**
 * Created by Jackiechan on 2022/4/24 11:37
 *
 * @author Jackiechan
 * @version 1.0
 * @since 1.0
 */
public enum ProvinceCode {
    BEIJING("11","北京"),
    TIANJIN("12","天津"),
    HEBEI("13","河北"),
    SHANXI("14","山西"),
    NEIMENGGU("15","内蒙古"),
    LIAONING("21","辽宁"),
    JILIN("22","吉林"),
    HEILONGJIANG("23","黑龙江"),
    SHANGHAI("31","上海"),
    JIANGSU("32","江苏"),
    ZHEJIANG("33","浙江"),
    ANHEI("34","安徽"),
    FUJIAN("35","福建"),
    JIANGXI("36","江西"),
    SHANDONG("37","山东"),
    HENAN("41","河南"),
    HUBEI("42","湖北"),
    HUNAN("43","湖南"),
    GUANGDONG("44","广东"),
    GUANGXI("45","广西"),
    HAINAN("46","海南"),
    CHONGQING("50","重庆"),
    SICHUAN("51","四川"),
    GUIZHOU("52","贵州"),
    YUNNAN("53","云南"),
    XIZANG("54","西藏"),
    SHANNXI("61","陕西"),
    GANSU("62","甘肃"),
    QINGHAI("63","青海"),
    NINGXIA("64","宁夏"),
    XINJIANG("65","新疆"),
    TAIWAN("71","台湾"),
    XIANGGANG("81","香港"),
    AOMEN("82","澳门");

    private String code;
    private String name;

    ProvinceCode(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据用户的身份证号获取省份
     * @param id
     * @return
     */
   public static String getProvince(String id) {
        ProvinceCode[] codes = ProvinceCode.values();
       for (ProvinceCode code : codes) {
           if (id.startsWith(code.code)) {
               return code.getName();
           }
       }
       return null;
    }
}
